package com.prs.crm.dao.flow.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.flow.WorkFlowNodeDao;
import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.flow.WorkFlowNode;

public class WorkFlowNodeDaoImpl extends BaseDaoImpl<WorkFlowNode> implements WorkFlowNodeDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<WorkFlowNode> getWorkFlowNode(Integer id) {
		Criteria criteria=this.getSession().createCriteria(WorkFlowNode.class);
		criteria.createAlias("flow", "f");
		criteria.add(Restrictions.eq("f.id",id));
		criteria.addOrder(Order.asc("sequence"));
		return criteria.list();
	}
}
